package org.itboys.mobile.dto.count;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.itboys.mobile.dto.common.MobileBaseDto;

import java.math.BigDecimal;

/**
 * 作者：jiangxiong
 * 日期：2017年5月8日
 * 描述：圣代_结算_商品_dto。
 */

public class SundayCountProductDto extends MobileBaseDto{
    //基本属性
    private Long cartId;//购物车Id
    private String name;//产品名称
    private String barCode;//商品编码
    private String image;//产品主图
    private Integer num;//数量
    private String standard;//规格。组合的字符串。
    private Integer status;//0失效，1正常
    private Integer store;//库存。2017年8月17日新增
    private BigDecimal price;//零售价或销售价
    @JsonIgnore
    private BigDecimal marketPrice;//市场价
    private Integer type;//类型 1普通，2新品，3特卖，4全球购，5金领，6爱购币，7积分(废弃)，8秒杀，9拼团，10试用
    //2018年1月21日，根据商品类型，需要一些的特殊属性
    //全球购
    @JsonIgnore
    private BigDecimal tax;//关税
    @JsonIgnore
    private String taxMsg;//关税、发货地等说明
    //秒杀(疯抢)
    @JsonIgnore
    private String secKillTimeGroupValue;//秒杀商品时间组value。从字典中获取
    //拼团
    @JsonIgnore
    private BigDecimal teamPrice;//拼团价格




    @JsonIgnore
    private Integer saleNumber;//产品当前销量，用于后面更新产品销量
    @JsonIgnore
    private Long shopId;//门店ID
    @JsonIgnore
    private String shopName;//门店图标
    @JsonIgnore
    private String shopImage;//门店头像
    @JsonIgnore
    private String shopDesc;//门店描述

    //2018年2月8日
    private Integer isDiscount;//是否允许折扣;

    public SundayCountProductDto() {
    }

    public SundayCountProductDto(long id, String createTime, String createDate,
                                 Long cartId, String name, String barCode, String image,
                                 Integer num, String standard, Integer status, Integer store,
                                 BigDecimal price, BigDecimal marketPrice,Integer type, Integer saleNumber,
                                 Long shopId, String shopName, String shopImage, String shopDesc,Integer isDiscount) {
        super(id, createTime, createDate);
        this.cartId = cartId;
        this.name = name;
        this.barCode = barCode;
        this.image = image;
        this.num = num;
        this.standard = standard;
        this.status = status;
        this.store = store;
        this.price = price;
        this.marketPrice = marketPrice;
        this.type=type;
        this.saleNumber = saleNumber;
        this.shopId = shopId;
        this.shopName = shopName;
        this.shopImage = shopImage;
        this.shopDesc = shopDesc;
        this.isDiscount=isDiscount;
    }



    public Long getCartId() {
        return cartId;
    }

    public void setCartId(Long cartId) {
        this.cartId = cartId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getBarCode() {
        return barCode;
    }

    public void setBarCode(String barCode) {
        this.barCode = barCode;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public String getStandard() {
        return standard;
    }

    public void setStandard(String standard) {
        this.standard = standard;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStore() {
        return store;
    }

    public void setStore(Integer store) {
        this.store = store;
    }

    public BigDecimal getPrice() {
        if(price!=null)price=price.setScale(2,BigDecimal.ROUND_HALF_UP);
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getMarketPrice() {
        return marketPrice;
    }

    public void setMarketPrice(BigDecimal marketPrice) {
        this.marketPrice = marketPrice;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public BigDecimal getTax() {
        return tax;
    }

    public void setTax(BigDecimal tax) {
        this.tax = tax;
    }

    public String getTaxMsg() {
        return taxMsg;
    }

    public void setTaxMsg(String taxMsg) {
        this.taxMsg = taxMsg;
    }

    public String getSecKillTimeGroupValue() {
        return secKillTimeGroupValue;
    }

    public void setSecKillTimeGroupValue(String secKillTimeGroupValue) {
        this.secKillTimeGroupValue = secKillTimeGroupValue;
    }

    public BigDecimal getTeamPrice() {

        if(teamPrice!=null)teamPrice=teamPrice.setScale(2,BigDecimal.ROUND_HALF_UP);
        return teamPrice;
    }

    public void setTeamPrice(BigDecimal teamPrice) {
        this.teamPrice = teamPrice;
    }

    public Integer getSaleNumber() {
        return saleNumber;
    }

    public void setSaleNumber(Integer saleNumber) {
        this.saleNumber = saleNumber;
    }

    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public String getShopImage() {
        return shopImage;
    }

    public void setShopImage(String shopImage) {
        this.shopImage = shopImage;
    }

    public String getShopDesc() {
        return shopDesc;
    }

    public void setShopDesc(String shopDesc) {
        this.shopDesc = shopDesc;
    }

    public Integer getIsDiscount() {
        return isDiscount;
    }

    public void setIsDiscount(Integer isDiscount) {
        this.isDiscount = isDiscount;
    }

    public BigDecimal getTotalPrice(){
        if(price!=null&&num!=null){
            return price.multiply(new BigDecimal(num));
        }
        return null;
    }
    public String getTypeStr(){
        String typeStr= "";
        if(type==null)return typeStr;

        switch (type) {
            case 1:
                typeStr="普通";
                break;
            case 2:
                typeStr="新品";
                break;
            case 3:
                typeStr="特卖";
                break;
            case 4:
                typeStr="全球购";
                break;
            case 5:
                typeStr="分销";
                break;
            case 6:
                typeStr="爱购币";
                break;
            case 7:
                typeStr="积分";
                break;
            case 8:
                typeStr="秒杀";
                break;
            case 9:
                typeStr="拼团";
                break;
            case 10:
                typeStr="试用";
                break;
            default:
                break;
        }
        return typeStr;
    }
}
